<!DOCTYPE HTML>
<html lang="utf-8">
<head>
<meta charset="utf-8">
<title>驾车宝典-帖子详细页</title>
<link href="${ctx}/styles/forum.css" rel="stylesheet" type="text/css">
<#include '/baseHead.ftl'>
<!-- Baidu Button BEGIN -->
<script type="text/javascript" id="bdshare_js" data="type=slide&amp;img=0&amp;pos=right&amp;uid=0" ></script>
<script type="text/javascript" id="bdshell_js"></script>
<script type="text/javascript">
var bds_config={"bdTop":248};

<#if SESSION_MEMBER_KEY?exists>
	<#if SESSION_MEMBER_KEY.memberId ==  topic.fkCreateMemberId>
	<#assign isSelf=true>
	</#if>
</#if>

document.getElementById("bdshell_js").src = "http://bdimg.share.baidu.com/static/js/shell_v2.js?cdnversion=" + Math.ceil(new Date()/3600000);
</script>
<!-- Baidu Button END -->
<!--主要部分开始-->
<section id="main"><div class="bgA_01">
	
	<div id="leftArea">
	
		<div class="breadcrumbPanel_01">
			<p>
				<!-- <#macro forumList   cityNo,cateId,filter,titleTypeId,pageNumber,orderBy>${ctx}/forum/list/${cityNo}-${cateId}-${filter}-${titleTypeId}-${pageNumber}-${orderBy}</#macro>
				-->
				 <a href="/${ctx}" title="回到首页">首页</a> &gt;
				 <a href="<#if topic.topicType==1>
				 		<@forumList cityNo="${topic.cityNo}" cateId="${topic.fkCateId}" filter="0" titleTypeId="0" pageNumber="1" orderBy="1"  />
				 		<#else>
				 		 ${ctx}/activity/list/${topic.cityNo}-${topic.fkCateId}-0-0-1-1
				 		</#if>
				 		" title="${topic.cateName}">${topic.cateName}</a> &gt; 
				 <span class="on"> <a href="<#if topic.topicType==1>
				 						<@groupDetailLink groupId="${topic.fkGroupId?c}" />
				 						<#else>
				 							${ctx}/group/detail/a/${topic.fkGroupId?c}-1-1
				 						</#if>
				 						" title="${topic.groupName}">${topic.groupName}</a>
				 </span>
			</p>
		</div>
		 
		
		<div class="forumInfoPanel_01" style="height:150px;">
			<#if isLogin>
			<div class="btnField">
				<a href="#reply" class="btn btn1" title="点击回复">回复</a>
				<!-- <a href="#" class="btn btn2 btnDisable" title="赞">称赞<em>10</em></a> -->
			</div>
			</#if>
			<div class="imgField">
				<a href="<@userCenterLink  memberId="${topic.fkCreateMemberId?c}"/>" title="查看用户信息">
				<img src="${topic.createMemberHead!}" width="60" height="60" alt="会飞的鱼"> 
				</a>
			</div>
			<div class="infoField">
				<h2><em>[${topic.groupName!}]</em> <a href="<@userCenterLink  memberId="${topic.fkCreateMemberId?c}"/>" class="name" title="查看用户信息">${topic.createMemberName!}</a> 
				<#if isLogin>
					<span class="links">
						<#if isSelf || SESSION_MEMBER_KEY.isStaff == 1 ><a href="${ctx}/topic/edit/${topic.topicId?c}">编辑</a> </#if>
						<#if (topic.topType  == 0 )>
						    <#if  SESSION_MEMBER_KEY.isStaff == 1>         
						    	<a href="javascript:setTopType(${topic.topicId?c},3)">全站置顶</a> <a href="javascript:setTopType(${topic.topicId?c},2)">分类置顶</a>
						    </#if>
						     <#if  SESSION_MEMBER_KEY.isStaff == 1>         
						    <a href="javascript:setTopType(${topic.topicId?c},1)">组内置顶</a> 
						    </#if>
					    <#else>
					    	 <#if  SESSION_MEMBER_KEY.isStaff == 1 || ( isGroupMaster && topic.topicType == 1) >         
					    		<a href="javascript:cancleTopType(${topic.topicId?c},${topic.topType})">取消置顶</a> 
					 	  	 </#if>
					    </#if>
					    
					    <#if isSelf || SESSION_MEMBER_KEY.isStaff==1> <a href="javascript:deleteTopic(${topic.topicId?c})">删除</a></#if> 
					      </span>
				</#if>
				</h2>
				<p>浏览次数：${topic.clickCount!} 时间：${topic.createDate?datetime}&nbsp;&nbsp;回复${topic.replyCount}</p>
			</div>
		</div>
		
		<div class="forumContentPanel_01">
			<div class="titleField">
				<h1>${topic.topicTitleAfterFilter!}</h1>
				<h2>“<a href="#" class="name" title="查看用户信息">${topic.createMemberName!}</a> 发表于 ${topic.createDate?datetime}”</h2>
				<h2>${topic.lastOperateLog!}</h2>
			</div>
			<div class="textField">
				${topic.topicContAfterFilter!}
			</div>
			<#if  (topic.topicType == 2 && topic.jionActivityMemberCount >0 )>
			<div class="memberField">
				<div class="title">
					<h2>已报名用户：</h2>
				</div>
				<div class="list">
					<ul>
						<#list  activityMemberList as member>
						<li>
							<div class="img">
								<a href="#" title="${member.nickName}"><img src="${member.headImage!}" width="60" height="60" alt="${member.nickName}"></a>
								${member.nickName}
							</div>
						</li>
						</#list>
					</ul>
				</div>
				<#if (topic.jionActivityMemberCount >8 )>
				<div class="btns">
					<button class="btn btn1" title="点击展开">点击展开</button>
				</div>
				</#if>
			</div>
			</#if>
			<div class="listField">
				<#list replyPage.result as reply>
				<ul>
					<li>
						<div class="img">
							<a  href="<@userCenterLink memberId="${reply.replyMemberId?c}"/>" title="查看用户信息">
							<img src="${reply.replyMemberHead!}" width="60" height="60" alt="${reply.replyMemberName}"></a>
						</div>
						<div class="info">
							<span class="floor">${  ( (  replyPage.thisPageNumber - 1) *replyPage.pageSize ) + reply_index +  1 }楼</span>
							<a  name="${reply.replyId?c}"  href="#" class="name" title="查看用户信息">${reply.replyMemberName}</a>
							<span class="time">${reply.replyDate?datetime}</span>
						</div>
						<div class="text">
							<#if reply.isValid == 1>
							${reply.replyContAfterFilter!}
							<#else>
								该回复已被删除
							</#if>
						</div>
						<div class="btns">
							<!--
							<a href="#" class="btn btn1" title="引用">引用</a>
							-->
						</div>
					</li>
				</ul>
				</#list>
			</div>
			<#if (replyPage.lastPageNumber > 1)  >
			<div class="pageNumField">
				<p>
				<#if !replyPage.firstPage>
					<a href="${ctx}/topic/detail/d/${topic.topicId?c}-1">首页</a>
					</#if>
					<#if replyPage.hasPreviousPage>
					<a href="${ctx}/topic/detail/d/${topic.topicId?c}-${pageNumber-1} ">上一页</a>
					</#if>
					<#list replyPage.getLinkPageNumbers() as item>
						<#if item_index==5> 
							<#break>
						</#if>
						<#if item == replyPage.thisPageNumber>
						<!--/{cityNo}-{cateId}-{filter}-{titleTypeId}-{pageNumber}-{orderBy} -->
							<a href="javascript:;" class="on">${item}</a>
						<#else>
								<a href="${ctx}/topic/detail/d/${topic.topicId?c}-${item}">${item}</a>
						</#if>
					</#list>
						<#if replyPage.hasNextPage>
					<a href="${ctx}/topic/detail/d/${topic.topicId?c}-${pageNumber+1}">下一页</a>
					</#if>
					<#if !replyPage.lastPage>
					<a  href="${ctx}/topic/detail/d/${topic.topicId?c}-${replyPage.lastPageNumber?c}" /> 末页</a>
					</#if>
				</p>
			</div>		
			</#if>	
		</div>
	</div>
	<div id="rightArea">
		 <#if topic.topicType == 2 && isLogin  &&  !hasJoin>
		<div class="signUpPanel_01">
			<div class="btnField">
				<button class="btn btn1" title="点击报名">我要报名</button>
			</div>
			<div class="infoField">
				<p>报名人数：${topic.jionActivityMemberCount}人</p>
			　　　	<!-- <p>活动热度： 6,336 正能量</p> -->
			</div>
		</div>
		</#if>
		 <#if topic.topicType == 2 && isLogin  &&  hasJoin>
		 <div class="signUpPanel_01">
		 	<div class="btnField">
				<button  title="点击退出" onclick='exitActivity();' style='display:block; padding:0 0 0 30px; width:243px; height:40px; line-height:40px; text-align:center; cursor:pointer; color:#fff;  font-size:14px; font-weight:bold;background: url(${ctx}/images/exitgroup.png) 0 0 no-repeat;'>我要退出</button>
			</div>
		</div>
		 </#if>
		<#if topic.topicType!=2>
		<div class="hotListPanel_01">
			<div class="titleField titleType_02">
				<h1>24小时热帖榜</h1>
			</div>
			
			<div class="listField">
				<ul>
					<#list smgTopicList as topic>
					<li>
						<!-- <#macro groupDetailLink  groupId>${ctx}/group/detail/${groupId}</#macro>-->
						<div class="img">
							<a href="<@groupDetailLink groupId="${topic.fkGroupId?c}" />" title="${topic.groupName!}">
							<img src="${topic.picview!}" width="60" height="60" alt="">
							</a>
						</div>
						<div class="info">
							<!-- <#macro topicDetailLink  topicId>${ctx}/topic/detail/${topicId}</#macro> -->
							<h2 style="height:26px;"><a href="<@topicDetailLink topicId="${topic.topicId?c}"/>" title="${topic.topicTitleAfterFilter!}">${topic.topicTitleAfterFilter!}</a></h2>
							<!-- <#macro userCenterLink  memberId>${ctx}/member/${memberId}</#macro>
							 -->
							<p>来自 <a class="name" href="<@userCenterLink memberId="${topic.fkCreateMemberId?c}" />" title="查看个人信息">${topic.createMemberName!}</a></p>
						</div>
					</li>
					</#list>
				</ul>
			</div>
		</div>
		</#if>
		<div class="activityPanel_03" style='display:none'>
			<div class="titleField titleType_02">
				<h1>正在进行的活动</h1>
			</div>
			<div class="listField">
				<ul>
					<#list activityList as activity>
					<li>
						<div class="img">
							<a href="<@topicDetailLink topicId="${activity.topicId}" />" title="查看详情">
							<img src="${activity.picview!}" width="99" height="65" alt="${activity.topicTitleAfterFilter!}">
							</a>
						</div>
						<div class="text">
							<a href="<@topicDetailLink topicId="${activity.topicId}" />" title="查看详情"><strong>活动：</strong>
							<#if  (activity.topicTitleAfterFilter?length > 20 )>
								${activity.topicTitleAfterFilter?substring(0,20)}
							<#else>
								${activity.topicTitleAfterFilter!}
							</#if>
							</a>
						</div>
					</li>
					</#list>
				</ul>
			</div>
		</div>
		
		
	</div>
	<#if isLogin>
	<div class="subCommentPanel_01">
		<div class="imgField">
			<div class="img">
				<!-- <#macro userCenterLink  memberId>${ctx}/member/${memberId}</#macro>-->
				<a  name="reply" href="<@userCenterLink memberId="${loginMember.memberId?c}"/>" title="个人信息"><img src="${loginMember.headImage!}" width="85" height="85" alt="${loginMember.nickName!}"></a>
			</div>
		</div>
		<form id="editorForm" action="${ctx}/topic/createreply" method="post">
		<div class="formField">
			<div class="formContent">
			  	 	<textarea id="content" name="replyContBeforFilter" style="height:238px;width:768px"></textarea>
			</div>
			<div class="formBtns">
				  <input type="button" class="btn btn1" onclick='checkSubmit();' value="" style='width:85px;background:url(${ctx}/images/btn_bg_107.gif) 0 0 no-repeat'></button>
				<!--<input type="checkbox" id="jumpToLast" name="jumpTo" class="check" checked><label for="jumpToLast">回贴后跳转到最后一页</label>-->
			</div>
		</div>
			<input type="hidden" name="fkTopicId" id="fkTopicId" value="${topic.topicId?c}">
		</form>
	</div>
	</#if>
	
<#include '/commonFriendLink.ftl'>
<#if topic.topicType == 2 && isLogin>
<!--弹出框开始-->
<section id="jumpBox">
	<div class="mask"></div>
	<div class="signUpPanel_02" style="margin: -90px 0 0 -300px;height: 424px;">
		<div class="closeField">
			<button class="btn close" title="关闭" >关闭</button>
		</div>
		<form action="${ctx}/topic/joinactivity/${topic.topicId?c}" id="joinForm" method="post">
		<div class="infoField">
			<div class="img">
				<a class="name" href="#" title="个人信息"><img src="${loginMember.headImage!}" width="60" height="60" alt=">${loginMember.nickName!}"></a>
			</div>
			<div class="info">
				<h2><a class="name" href="#" title="个人信息">${loginMember.nickName!}</a></h2>
				<!-- <p>新手上路</p> -- >
				<!--这怎么会有个等级称号？？？-->
			</div>
			<div class="state">
				<p>活动性质：</p>
				<div class="btns">
					<span class="btn btn1">
						<#if activity.activityType == 1>
							免费活动
						<#elseif activity.activityType == 2>
							付费活动
						<#elseif activity.activityType == 3>
						    消耗正能量
						</#if>
					</span>
					<!--<span class="btn btn2">未455款</span>-->
				</div>
			</div>
		</div>
		<div class="titleField">
			<h1>${topic.topicTitleAfterFilter!}</h1>
		</div>
		<div class="formField">
			<dl>
				<dt><b>尊姓大名：</b></dt>
				<dd>
					<input type="text" class="txt txt1" value="" name="realName" id="realName">
					<select class="select" id="sex" name="sex"><!--设计图上没说这个SELECT是干啥的-->
						<option value="">-性别-</option>
						<option value="m">先生</option>
						<option value="m">女士</option>
					</select>
				</dd>
			</dl>
			<dl>
				<dt><b>联系电话：</b></dt>
				<dd><input type="text" class="txt" value="" name="tel" id="tel"></dd>
			</dl>
			<dl>
				<dt>快递地址：</dt>
				<dd><input type="text" class="txt" value="" id="address" name="address"></dd>
			</dl>
			<dl>
				<dt>邮箱：</dt>
				<dd><input type="text" class="txt" value="" name="email" id="email"></dd>
			</dl>
			<#if (activity.point > 0 ) >
		
			<b><h2>该活动需消耗正能量:${activity.point!}</h2></b>
			</#if>
			<!--
				
				<p>380元/成人 <select class="select"><option>人数</option><option>1</option><option>2</option></select> 260元/儿童 <select class="select"><option>人数</option><option>1</option><option>2</option></select> 0元/婴儿 <select class="select"><option>人数</option><option>1</option><option>2</option></select></p>
				知道你要吐槽 设计图上这里就是一堆select...
				<p>总计：<em>1020</em> 元</p>
				<p>您可以选择以下付款方式：</p>
				<div class="img">
					<img src="images/pic_paymentWay_01.jpg" width="432" height="126" alt="付款方式">
				</div>	
			-->
				<div class="btns">
					<!--<button title="立即付款" class="btn btn1"></button>-->
					<input type='button' class="btn btn2" onclick='checkJoin();'></button>
				</div>
		
		</div>
		<div class="textField">
			<p>注：报名后24小时内保留活动名额，超过24小时取消名额。</p>
		</div>
	</div>
	</form>
</section>
<!--弹出框结束-->
</#if>

</div></section>
<!--主要部分结束-->
<#include '/baseFoot.ftl'>
<script charset="gbk" src="${ctx}/scripts/kindeditor-min.js"></script>
<script>
	function  closeMask(){
		$('#mask').toggle();
	
	}
	function checkJoin(){
		if ( checkInputValue("sex","11","string",false,false)
		     && checkInputValue("realName","30","string",false,false)
		     && checkInputValue("tel","30","number",false,false)
		     && checkInputValue("address","100","string",true,false)
		      && checkInputValue("email","50","string",true,false)
		     ){
		     	document.getElementById("joinForm").submit();
		   }  
		     
	}
	function calRemain(){
		if ( $('#topicTitleBeforeFilter').val().length > 30 ){
			$('#remain').html("0");
			 $('#topicTitleBeforeFilter').val( $('#topicTitleBeforeFilter').val().substr(0,30) );
		}
		$('#remain').html(30 -   $('#topicTitleBeforeFilter').val().length);
	}
	function checkSubmit(){
	var  content = $('#content').val();
		if ( content.length <  20 ){
			alert('内容不能少于20个字');
			return ;
		}
		document.forms["editorForm"].submit();
	}
	$(function(){
				KE.show({
				id : "content",
				imageUploadJson : '${ctx}/image/uploadimage',
					items : ['source','fontname', 'fontsize', '|', 'undo','redo','plainpaste','wordpaste','|', 'textcolor', 'bgcolor', 'bold', 'italic', 'underline','removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist','insertunorderedlist','advtable','hr', '|', 'emoticons', 'image', 'link','|','flash','media'],
				resizeMode : 1,
				allowPreviewEmoticons : true,
				allowUpload : true,
				afterCreate : function(id) {
					KE.event.ctrl(document, 13, function() {
						KE.util.setData(id);
						if(checkSubmit()!=false)
							document.forms["editorForm"].submit();
					});
					KE.event.ctrl(KE.g[id].iframeDoc, 13, function() {
						KE.util.setData(id);
						if(checkSubmit()!=false)
							document.forms["editorForm"].submit();
					});
				}
				});
		});
	function cancleTopType(topicId,topType){
	
		if ( confirm("确认取消置顶?")){
		
			$.ajax({
		 			type: "get",
					url: "${ctx}/topic/cancleTopicTopType",
					beforeSend: function(XMLHttpRequest){
					//ShowLoading();
					},
					success: function(data, textStatus){
						if ( data.state == 1 ){
							alert("操作成功!");
							window.location.href = "${ctx}/topic/detail/${topic.topicId?c}";
						}else{
							alert(data.desc);
						}
					},
					data:{
						topicId:topicId,
						topType:topType
					},
					dataType:'json'
				}
	 		)
		}
	}
	function setTopType(topicId,topType){
	
	if ( confirm("确认置顶?")){
		
			$.ajax({
		 			type: "get",
					url: "${ctx}/topic/setTopicTopType",
					beforeSend: function(XMLHttpRequest){
					//ShowLoading();
					},
					success: function(data, textStatus){
						if ( data.state == 1 ){
							alert("操作成功!");
							window.location.href = "${ctx}/topic/detail/${topic.topicId?c}";
						}else{
							alert(data.desc);
						}
					},
					data:{
						topicId:topicId,
						topType:topType
					},
					dataType:'json'
				}
	 		)
		}
	}
	function deleteTopic(topicId){
	
	if ( confirm("确认删除?")){
		
			$.ajax({
		 			type: "get",
					url: "${ctx}/topic/deleteTopic",
					beforeSend: function(XMLHttpRequest){
					//ShowLoading();
					},
					success: function(data, textStatus){
						alert("删除成功!");
						window.location.href = "${ctx}/forum/${topic.cityNo}";
					},  
					data:{
						topicId:topicId
					},
					dataType:'json'
				}
	 		)
		}
	}
	function exitActivity(){
		if ( confirm("确认退出活动吗?") ){
		     $.ajax({
		 			type: "get",
					url: "${ctx}/topic/exitactivity",
					beforeSend: function(XMLHttpRequest){
					//ShowLoading();
					},
					success: function(data, textStatus){
						alert("退出成功!");
						window.location.href = "${ctx}/topic/detail/${topic.topicId?c}";
					},  
					data:{
						topicId:${topic.topicId?c}
					},
					dataType:'json'
				}
	 		)
		}
	}
	
</script>
<script>autoEqHeight = false;</script>